<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<style>
  .box {
    display: flex;
    flex-wrap: wrap;
    height: 300px;
  }


  .item {
    width: 100px;
    background-color: #ccc;
    margin: 10px;
  }

  .item:hover {
    background-color: red;
  }

  .item:not(:hover) {
    background-color: #7846ba;
  }
</style>

<body>
  <div class="box">
    <div class="item">1</div>
    <div class="item">2</div>
    <div class="item">3</div>
    <div class="item">4</div>
  </div>

  <script>

    setTimeout(() => {
      console.log('setTimeout');
    }, 50)
    requestAnimationFrame(() => {
      console.log('requestAnimationFrame');
    })

  </script>
</body>

</html>